<template>
    <div>
        <!-- 内视图 -->
        <avue-data-tabs :option="option"></avue-data-tabs>
        <img src="@/assets/cover.png" style="width: 30%;" alt="辅助图片" class="login-image">
    </div>
</template>
<script>
export default {
    created(){
        this.fetchData();
    },
    data() {
        return {
            option: {
                data: [
                    {
                        title: '学生对象',
                        subtitle: '实时',
                        count: 7993,
                        text: '当前学生总记录数',
                        color: 'rgb(27, 201, 142)',
                        key: '人'
                    },
                    {
                        title: '体侧项目',
                        subtitle: '实时',
                        count: 3112,
                        text: '当前体侧项目数',
                        color: 'rgb(230, 71, 88)',
                        key: '项'
                    },
                    {
                        title: '体侧数据记录',
                        subtitle: '实时',
                        count: 908,
                        text: '数据记录数',
                        color: 'rgb(178, 159, 255)',
                        key: '记'
                    }
                ]
            }
        }
    },
    
    methods:{
        fetchData(){
            this.$ajax.get("/test-data/list").then(res => {
                this.option.data[2].count = res.length;
            });
            this.$ajax.get("/test-item/list").then(res => {
                this.option.data[1].count = res.length;
            });
            this.$ajax.get("/student/list").then(res => {
                this.option.data[0].count = res.length;
            })
        }
    }
}
</script>